<div class="r_top_sell">
<h3>Top Sellers</h3>
                <?php
				$sql = "SELECT t1.*, t1.top_sale, t3.price, t3.pid, t2.images, t2.thumbnail FROM tblproduct as t1 ".
					   "INNER JOIN tblimage as t2 on t1.id=t2.product_id ".
					   "INNER JOIN tblproduct_in_pharmacy as t3 on t1.id=t3.product_id ".
					   "WHERE t1.status = 1 ORDER BY t1.top_sale DESC LIMIT 0,5";
				$result = mysql_query($sql);
				$i=0;
				$border = "";
				while($row = mysql_fetch_assoc($result)){
					if($i % 4 == 0 && $i>0){
						echo '';
					}else if ($i % 4 > 0){
						$border = '';
					}
				?>
                           
              <div class="top_sell">
                  <a href="product/product_detail.php?product_id=<?php echo $row['id']?>" title="<?php echo $row['product_name']?>"><img src="<?php echo W_S_IMAGES_DIR.$row['thumbnail']?>" /></a>
                  <span class="p-title"><span class="count"><?php echo $i+1; ?>.</span> <a class="pro-name" href="product/product_detail.php?product_id=<?php echo $row['id']?>" title="<?php echo $row['product_name']?>"><?php echo $row['product_name']?></a><br/></span>
				  <div style="color:#990000;">$&nbsp;<?php echo $row['price']?></div>
                  <div class="clear"></div>
              </div>
               <?php $i++; } ?>
        
            <?php // echo $testing; ?>
</div>            